<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>8 微博发布案例</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul {
            list-style:none;
        }
        .box {
            width: 600px;
            margin: 0px auto;
            border: 1px solid #000;
            padding: 20px;
        }
        textarea {
            width: 450px;
            height: 160px;
            outline:none; /*去掉环绕线*/
            resize: none; /*禁用拖动*/
        }
        ul {
            width: 450px;
            padding-left: 80px;
        }
        ul li {
            /*line-height: 25px;*/
            height: 25px;
            width: 450px;
            /*border: 1px solid #000;*/
            border-bottom: 1px dashed #cccccc;
        }
        input {
            float: right;
        }
    </style>
    <script src="../angular-1.5.8/angular.js"></script>
</head>
<body>
<div class="box" ng-app="myApp" ng-controller="myCtrl">
    <span>微博发布</span>
    <textarea cols="30" rows="10" ng-model="value"></textarea>
    <button ng-click="fabu()">发布</button>
    <ul>
        <li ng-repeat="item in arr track by $index"> {{item}}<input type="button" value="删除" ng-click="app($index)"/></li>
    </ul>
</div>

</body>
</html>
<script>

    var app = angular.module("myApp",[])
    app.controller("myCtrl",function ($scope) {
        $scope.arr = []
        $scope.app = function (index) {
            $scope.arr.splice(index,1)
        }
        $scope.fabu = function () {
            $scope.arr.unshift($scope.value)
            $scope.value = ""
        }
    })

</script>























